using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Bounce
{
    /// <summary>
    /// This is a game component that implements IUpdateable.
    /// </summary>
    public abstract class Entity
    {
        public Entity(Vector2 vPosition)
        {
            PreviousPosition = vPosition;
            Position = vPosition;
            Rotation = 0.0f;
            Scale = Vector2.One;
            Color = Color.White;
            Origin = Vector2.Zero;
            Layer = 1.0f;

            Velocity = Vector2.Zero;
        }

        public virtual void Move()
        {
            Position += FrameVelocity;
        }

        public void UpdateVelocity(float x, float y)
        {
            Velocity.X = x;
            Velocity.Y = y;
        }

        public void Draw(SpriteBatch oSpriteBatch, Texture2D oTexture)
        {
            oSpriteBatch.Draw(
                oTexture, 
                Position, null, 
                Color, 
                Rotation, 
                Origin, 
                Scale, 
                SpriteEffects.None, 
                Layer);
        }

        #region Properties

        public Vector2 PreviousPosition;
        public Vector2 PreviousVelocity;
        public Vector2 Position;
        public float Rotation;
        public Color Color;
        public Vector2 Scale;
        public Vector2 Origin;
        public float Layer;
        public Vector2 Velocity;
        public Vector2 FrameVelocity;

        #endregion

    }
}
